
export function parseURL(url) {
  const regex = /^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/;
  const result = regex.exec(url);
  
  return {
    protocol: result[1],
    host: result[2],
    path: result[3],
    query: result[4],
    fragment: result[5]
  };
}